package com.suzj.extraenchantments.util;


import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import org.joml.Vector3d;


public class Vector3 {
    public static final Vector3 ZERO = new Vector3(0.0d, 0.0d, 0.0d);
    public static final Vector3 ONE = new Vector3(1.0d, 1.0d, 1.0d);
    public static final Vector3 CENTER = new Vector3(0.5d, 0.5d, 0.5d);
    public final double x;
    public final double y;
    public final double z;

    public Vector3(double d, double d1, double d2) {
        this.x = d;
        this.y = d1;
        this.z = d2;
    }

    public Vector3(Vec3 vec) {
        this(vec.x, vec.y, vec.z);
    }

    public static Vector3 fromEntityCenter(Entity e) {
        return new Vector3(e.getX(), (e.getY() - e.getMyRidingOffset()) + (e.getBbHeight() / 2.0f), e.getZ());
    }

    public Vector3 multiply(double d) {
        return multiply(d, d, d);
    }

    public Vector3 multiply(double fx, double fy, double fz) {
        return new Vector3(this.x * fx, this.y * fy, this.z * fz);
    }

    public double mag() {
        return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z));
    }
}